<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>对象方法的简写形式</title>
  <script type="text/javascript">
    // 传统-对象方法定义
    let monster = {
      name: "红孩儿",
      age: 100,
      sayHi: function (){
        console.log("信息: name=", this.name, " age=", this.age);
      }
    }
    monster.f10 = function () {
      console.log("哈哈");
    };
    monster.sayHi();
    monster.f10();

    // ES6-对象方法定义
    let monster2 = {
      name: "红孩儿",
      age: 100,
      sayHi(){
        console.log("信息: name=", this.name, " age=", this.age);
      },
      f1(){
        console.log("f1()");
      }
    }
    monster2.sayHi();
    monster2.f1();
  </script>
</head>
<body>

</body>
</html>
